package com.example.demo;

import java.util.Arrays;
import java.util.Comparator;

public class Solution {
    private static int[][] points = {{-2147483646,-2147483645},{2147483646,2147483647}};

    public static void main(String[] args) {
        int i = findMinArrowShots(points);
        System.out.println(i);
    }
    public static int findMinArrowShots(int [][] points) {
        int count = 1;
        Arrays.sort(points,new Comparator<int[]>(){
            @Override
            public int compare(int[] a, int[] b){
                if(a[1] < b[1]){
                    return -1;
                }else if(a[1] > b[1]){
                    return 1;
                }else{
                    return 0;
                }
            }
        });
        int cur = points[0][1];
        for(int i = 1; i < points.length; i++){
            if(cur < points[i][0]){
                cur = points[i][1];
                count++;
            }
        }
        return count;
    }
}
